package com.haima.test1;

import java.util.ArrayList;

public class t4 {
    public static void main(String[] args) {
        /*已知String数组中存放了QQ号码，QQ号码最长为11位，最短为5位
        String[] str = {"12321","45678","66789","12345678909","45678","12345678909"};
        将该数组的所有qq号都存放在ArrayList中，并且保证ArrayList中的qq号没有重复的打印出来*/
        String[] str = {"12321", "45678", "66789", "12345678909", "45678", "12345678909"};
        ArrayList<String> list = new ArrayList<>();
        for (int i = 0; i < str.length; i++) {
            list.add(str[i]);
        }
        //ArrayList<String> zui = new ArrayList<>();
        for (int i = 0; i < list.size(); i++) {
            for (int j = 0; j < list.size(); j++) {
                if (i != j && list.get(i).equals(list.get(j))) {
                    list.remove(j);
                }
            }
        }
        System.out.println(list);
    }
}
